package com.lxz.ob_shape_print;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ShapePrint {
    List<Shape> shapes = new ArrayList<>();

    public void addShape(Shape shape) {
        shapes.add(shape);
    }

    public void printShape(int sequence) {
        if (sequence > shapes.size()||sequence<=0) {
            System.out.println("未实现图形");
//             return;
        } else {
            Shape shape = shapes.get(sequence - 1);
            shape.draw();
        }
    }


    public void startShape() {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < shapes.size(); i++) {
            Shape shape = shapes.get(i);
            System.out.println(i + 1 + "ge->print" + shape.getName());
        }

        while (true) {
            int Sequences = sc.nextInt();
            printShape(Sequences);
        }

    }


    public static void main(String[] args) {
        ShapePrint shapePrint = new ShapePrint();
        shapePrint.addShape(new Linear());
        shapePrint.addShape(new Circle());
        shapePrint.addShape(new Rectangle());
        shapePrint.addShape(new Star());
        shapePrint.startShape();
    }
}
